package com.ulic.customerManApplication.membermodule.bo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.ulic.customerManApplication.journeylovemodule.bo.JourneyOfLoveActivity;
import com.ulic.customerManApplication.memberenjoymodule.bo.MemberEnjoyActivity;
import com.ulic.customerManApplication.usermodule.bo.User;

@Entity
@Table(name="T_GYW_SUB_MEMBER")
@SequenceGenerator(name="sub_member_seq",sequenceName="S_GYW_SUB_MEMBER_ID")
public class SubMember implements Serializable{

	/**
	 * 会员信息
	 */
	private static final long serialVersionUID = 1L;
	private int sub_id;//编号
	private String sub_memberName;//会员姓名
	private String sub_gender;//性别
	private String sub_idCard;//身份证号码
	private String sub_birthday;//生日
	private String sub_cellPhone;//手机
	private String sub_email;//电子邮件
	private String sub_memberType;//会员类型
	private String sub_carType;//车辆类型
	private String sub_carBrand;//车辆品牌
	private Integer sub_donateStuNum;//捐助学生人数
	private String sub_donateRecord;//捐助记录
	private String sub_reproduceIntroduce;//转介绍记录
	private String sub_forumPosting;//论坛回帖记录
	private Date sub_createDate;//创建时间
	private String sub_remark;//备注
	
	private String subCompany;//所属分公司
	
	private String subCity;//所属中支
	
	private String subComName;//分公司名称
	
	private String subCityName;//中支名称
	
	private User sub_user;//创建者

	private JourneyOfLoveActivity sub_journeyOfLoveActivity;//所属爱心之旅活动
	private MemberEnjoyActivity sub_memberEnjoyActivity;	//会员专项活动
	
	private SubMember parentMember;		//父
	private List<SubMember> childrenMember = new ArrayList<SubMember>(0);
	private Member member;				//对应的会员
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="sub_member_seq")
	public int getSub_id() {
		return sub_id;
	}
	public void setSub_id(int subId) {
		sub_id = subId;
	}
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, optional = true)   
    @JoinColumn(name="JOURNEYLOVE_ID" , nullable = true)
    public JourneyOfLoveActivity getSub_journeyOfLoveActivity() {
		return sub_journeyOfLoveActivity;
	}
	public void setSub_journeyOfLoveActivity(
			JourneyOfLoveActivity subJourneyOfLoveActivity) {
		sub_journeyOfLoveActivity = subJourneyOfLoveActivity;
	}
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, optional = true)   
	@JoinColumn(name="MEMBERENJOY_ID" , nullable = true)
	public MemberEnjoyActivity getSub_memberEnjoyActivity() {
		return sub_memberEnjoyActivity;
	}
	public void setSub_memberEnjoyActivity(
			MemberEnjoyActivity sub_memberEnjoyActivity) {
		this.sub_memberEnjoyActivity = sub_memberEnjoyActivity;
	}
	public String getSub_memberName() {
		return sub_memberName;
	}
	public void setSub_memberName(String subMemberName) {
		sub_memberName = subMemberName;
	}
	public String getSub_gender() {
		return sub_gender;
	}
	public void setSub_gender(String subGender) {
		sub_gender = subGender;
	}
	public String getSub_idCard() {
		return sub_idCard;
	}
	public void setSub_idCard(String subIdCard) {
		sub_idCard = subIdCard;
	}
	public String getSub_birthday() {
		return sub_birthday;
	}
	public void setSub_birthday(String subBirthday) {
		sub_birthday = subBirthday;
	}
	public String getSub_cellPhone() {
		return sub_cellPhone;
	}
	public void setSub_cellPhone(String subCellPhone) {
		sub_cellPhone = subCellPhone;
	}
	public String getSub_email() {
		return sub_email;
	}
	public void setSub_email(String subEmail) {
		sub_email = subEmail;
	}
	public String getSub_memberType() {
		return sub_memberType;
	}
	public void setSub_memberType(String subMemberType) {
		sub_memberType = subMemberType;
	}
	public String getSub_carType() {
		return sub_carType;
	}
	public void setSub_carType(String subCarType) {
		sub_carType = subCarType;
	}
	public String getSub_carBrand() {
		return sub_carBrand;
	}
	public void setSub_carBrand(String subCarBrand) {
		sub_carBrand = subCarBrand;
	}
	public Integer getSub_donateStuNum() {
		return sub_donateStuNum;
	}
	public void setSub_donateStuNum(Integer subDonateStuNum) {
		sub_donateStuNum = subDonateStuNum;
	}
	public String getSub_donateRecord() {
		return sub_donateRecord;
	}
	public void setSub_donateRecord(String subDonateRecord) {
		sub_donateRecord = subDonateRecord;
	}
	public String getSub_reproduceIntroduce() {
		return sub_reproduceIntroduce;
	}
	public void setSub_reproduceIntroduce(String subReproduceIntroduce) {
		sub_reproduceIntroduce = subReproduceIntroduce;
	}
	public String getSub_forumPosting() {
		return sub_forumPosting;
	}
	public void setSub_forumPosting(String subForumPosting) {
		sub_forumPosting = subForumPosting;
	}
	public Date getSub_createDate() {
		return sub_createDate;
	}
	public void setSub_createDate(Date subCreateDate) {
		sub_createDate = subCreateDate;
	}
	public String getSub_remark() {
		return sub_remark;
	}
	public void setSub_remark(String subRemark) {
		sub_remark = subRemark;
	}
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, optional = false)   
    @JoinColumn(name="UM_USER_ID")
    public User getSub_user() {
		return sub_user;
	}
	public void setSub_user(User subUser) {
		sub_user = subUser;
	}
	public String getSubCompany() {
		return subCompany;
	}
	public void setSubCompany(String subCompany) {
		this.subCompany = subCompany;
	}
	public String getSubCity() {
		return subCity;
	}
	public void setSubCity(String subCity) {
		this.subCity = subCity;
	}
	public String getSubComName() {
		return subComName;
	}
	public void setSubComName(String subComName) {
		this.subComName = subComName;
	}
	public String getSubCityName() {
		return subCityName;
	}
	public void setSubCityName(String subCityName) {
		this.subCityName = subCityName;
	}
	@ManyToOne(fetch = FetchType.LAZY)   
    @JoinColumn(name="SUB_PARENT_ID" , nullable = true)
	public SubMember getParentMember() {
		return parentMember;
	}
	public void setParentMember(SubMember parentMember) {
		this.parentMember = parentMember;
	}
	@ManyToOne(fetch = FetchType.LAZY )   
    @JoinColumn(name="MEMBER_ID" , nullable = true)
	public Member getMember() {
		return member;
	}
	public void setMember(Member member) {
		this.member = member;
	}
	@OneToMany(mappedBy = "parentMember")
	public List<SubMember> getChildrenMember() {
		return childrenMember;
	}
	public void setChildrenMember(List<SubMember> childrenMember) {
		this.childrenMember = childrenMember;
	}
	
	
	
	
}
